{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "###Chapter 10 problem using Flopy###\n",
      "\n",
      "requires flopy, available at <link>https://pypi.python.org/pypi/flopy/2.2.306</link>\n",
      "or via pip install: <link>https://pypi.python.org/pypi/pip</link>\n",
      "\n",
      "much of this code follows the flopy tutorial: <link>https://flopy.googlecode.com/svn/sphinx/_build/html/tutorial2.html</link>"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "####Define general model characteristics####"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import os\n",
      "import numpy as np\n",
      "import matplotlib.pyplot as plt\n",
      "import pandas as pd\n",
      "import flopy\n",
      "\n",
      "%matplotlib inline\n",
      "\n",
      "#model domain and grid definition\n",
      "Lx = 1500.\n",
      "Ly = 1500.\n",
      "ztop = 600.\n",
      "zbot = 450.\n",
      "nlay = 1\n",
      "nrow = 15\n",
      "ncol = 15\n",
      "delr = Lx / ncol\n",
      "delc = Ly / nrow\n",
      "delv = (ztop - zbot) / nlay\n",
      "botm = np.linspace(ztop, zbot, nlay + 1)\n",
      "\n",
      "# properties\n",
      "Khvalues = {1: 44, 2: 5.5} # dictionary of K values by zone number (1 = sand, 2 = silt)\n",
      "Vani = 1.\n",
      "sy = 0.1\n",
      "ss = 1.e-4\n",
      "laytyp = 1\n",
      "\n",
      "# global BC settings\n",
      "m_riv = 2 # riverbed thickness\n",
      "w_riv = 100 # riverbed width\n",
      "R = 0.0001 # recharge rate\n",
      "Qleak = 45000 # flow through southern boundary (pos. = inflow)\n",
      "Rcond = 150000\n",
      "\n",
      "# pumping well for transient simulation\n",
      "QA2 = -20000\n",
      "pumping_well_info2 = [1, 7, 11, QA2] # l, r, c, Q\n",
      "QA3 = -30000\n",
      "pumping_well_info3 = [1, 9, 9, QA3] # l, r, c, Q\n",
      "\n",
      "# Stress Periods\n",
      "nper = 3\n",
      "perlen = [1, 3, 365]\n",
      "nstp = [1, 10, 20]\n",
      "tsmult = [1, 2, 2]\n",
      "steady = [True, False, False]\n",
      "\n",
      "# create flopy objects for packages\n",
      "modelname = 'P10'\n",
      "mf = flopy.modflow.Modflow(modelname, exe_name='mf2005')\n",
      "dis = flopy.modflow.ModflowDis(mf, nlay, nrow, ncol, delr=delr, delc=delc,\n",
      "                               top=ztop, botm=botm[1:],\n",
      "                               nper=nper, perlen=perlen, tsmult=tsmult, nstp=nstp, steady=steady)\n",
      "\n",
      "# Variables for the BAS package\n",
      "# Note that changes from the previous tutorial!\n",
      "ibound = np.ones((nlay, nrow, ncol), dtype=np.int32)\n",
      "strt = 515. * np.ones((nlay, nrow, ncol), dtype=np.float32) # starting heads\n",
      "bas = flopy.modflow.ModflowBas(mf, ibound=ibound, strt=strt)\n",
      "\n",
      "# Output Control\n",
      "words = ['head','drawdown','budget', 'phead', 'pbudget']\n",
      "save_head_every = 1\n",
      "oc = flopy.modflow.ModflowOc(mf, words=words, save_head_every=save_head_every, compact=True)\n",
      "\n",
      "# solver\n",
      "'''\n",
      "note: had trouble getting pcg to solve for some k values for the silt. Switched to NWT and it ran faster with no problems.\n",
      "'''\n",
      "#pcg = flopy.modflow.ModflowPcg(mf, relax=1)\n",
      "nwt = flopy.modflow.ModflowNwt(mf)\n",
      "\n",
      "# recharge package\n",
      "rch = flopy.modflow.mfrch.ModflowRch(mf, nrchop=3, irchcb=0, rech=R, irch=1, extension='rch', unitnumber=19)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 31
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "####Make the hydraulic conductivity array (upw package):"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# cell numbers with silt\n",
      "silt = np.append(np.arange(78, 84), np.arange(93, 99))\n",
      "silt"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 32,
       "text": [
        "array([78, 79, 80, 81, 82, 83, 93, 94, 95, 96, 97, 98])"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# now creaty Kzones array and assign second zone value to cells with silt\n",
      "Kzones = np.ones(225) * 1\n",
      "Kzones[silt] = 2\n",
      "Kzones = np.reshape(Kzones, (15, 15))\n",
      "\n",
      "# show the Kzones array\n",
      "plt.imshow(Kzones, interpolation='none')\n",
      "\n",
      "# save the Kzones for calibration with PEST\n",
      "np.savetxt('../pest/Kzones.dat', Kzones, delimiter=' ', fmt='%i')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAPwAAAD7CAYAAABOrvnfAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAD4BJREFUeJzt3X9Ilfffx/GXTSNIqhWpy2M7Uok/U8sQYqNanYIgaSaj\nXCj9Giw2thZRf92jGyqdi35s/40sY7GC/TFdOFmu2WIirZ02xhqzb3jYUctBTTd3KtN97j9aYt9b\nTa/Odaw+zwcc8Mfxen8Cn12e4/H6RBljjABYYdxYLwBA5BA8YBGCByxC8IBFCB6wCMEDFol268AT\nJ85RKPQftw4PYAiLFi1SQ0PDoJ+Lcuv38FFRUZLeHeYeDZIWuzH6MZvJ3Kd35uM6d7eGypof6QGL\nOA6+rq5OqampmjNnjsrLy8O5JgAucRR8X1+f3njjDdXV1eny5cv65JNP9Msvv4zyKF4nox/RWMxk\n7tM788mb6yj4CxcuaPbs2fJ6vYqJidHatWtVXV09yqN4nYx+RGMxk7lP78wnb66j4Nva2pSUlNT/\nvsfjUVtbm6MFAIgcR7+Wu/cM/Eg0DHjbq7H73xB4mgX+vT2co+ATExMVDAb73w8Gg/J4PIPcc7GT\nwwMYFa8ePJmeG/Kejn6kz8vL05UrVxQIBNTT06NTp06poKDAyaEARJCjM3x0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u7dq2AwqJaWFp08eVIvvfSSjh8/7vrchIQEJSUlqbm5WZJUX1+vjIwM1+empqaq\nqalJt27dkjFG9fX1Sk9Pd33ufQUFBaqqqpIkVVVVReQ/deneb50qKipUXV2tCRMmuD7v/jUpWlpa\n1NLSIo/HI7/fP/L/4ML4hOKI1NbWmpSUFDNr1iyzd+/eiMw8f/68iYqKMtnZ2SYnJ8fk5OSYL774\nIiKzjTGmoaEhos/S//DDDyYvL8/MnTvXvPzyyxF5lt4YY8rLy016errJzMw0JSUlpqenx5U5a9eu\nNc8995yJiYkxHo/HVFZWmhs3bpilS5eaOXPmGJ/PZ/744w/X5x45csTMnj3bzJw5s//76vXXX3dl\n5vjx4/v/rQMlJyeP6ll6XloLWIRX2gEWIXjAIgQPWITgAYsQPGARggcsQvCARQgesMj/AaTfUDG5\nVNnYAAAAAElFTkSuQmCC\n",
       "text": [
        "<matplotlib.figure.Figure at 0x11007add0>"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# assign K values based on zone\n",
      "hk = np.ones((15, 15), dtype=float) # initialize new array for Kvalues\n",
      "for z, v in Khvalues.iteritems(): hk[Kzones == z] = v # assign K value corresponding to zone for each value in Kzones array\n",
      "\n",
      "# make the lpf object\n",
      "#lpf = flopy.modflow.ModflowLpf(mf, hk=hk, vka=vka, sy=sy, ss=ss, laytyp=laytyp)\n",
      "upw = flopy.modflow.ModflowUpw(mf, hk=hk, vka=1, sy=sy, ss=ss, laytyp=laytyp)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 34
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "####Now make the river cells:####"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# bring in river cell information from csv file\n",
      "rivcells = pd.read_csv('../rivercells.csv')\n",
      "rivcells"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "html": [
        "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
        "<table border=\"1\" class=\"dataframe\">\n",
        "  <thead>\n",
        "    <tr style=\"text-align: right;\">\n",
        "      <th></th>\n",
        "      <th>layer</th>\n",
        "      <th>row</th>\n",
        "      <th>column</th>\n",
        "      <th>stage</th>\n",
        "      <th>Rcond</th>\n",
        "      <th>rbot</th>\n",
        "    </tr>\n",
        "  </thead>\n",
        "  <tbody>\n",
        "    <tr>\n",
        "      <th>0 </th>\n",
        "      <td> 1</td>\n",
        "      <td> 1</td>\n",
        "      <td>  1</td>\n",
        "      <td> 510.0</td>\n",
        "      <td> 150000</td>\n",
        "      <td> 506.0</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>1 </th>\n",
        "      <td> 1</td>\n",
        "      <td> 1</td>\n",
        "      <td>  2</td>\n",
        "      <td> 509.5</td>\n",
        "      <td> 150000</td>\n",
        "      <td> 505.5</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>2 </th>\n",
        "      <td> 1</td>\n",
        "      <td> 1</td>\n",
        "      <td>  3</td>\n",
        "      <td> 509.0</td>\n",
        "      <td> 150000</td>\n",
        "      <td> 505.0</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>3 </th>\n",
        "      <td> 1</td>\n",
        "      <td> 1</td>\n",
        "      <td>  4</td>\n",
        "      <td> 508.5</td>\n",
        "      <td> 150000</td>\n",
        "      <td> 504.5</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>4 </th>\n",
        "      <td> 1</td>\n",
        "      <td> 1</td>\n",
        "      <td>  5</td>\n",
        "      <td> 508.0</td>\n",
        "      <td> 150000</td>\n",
        "      <td> 504.0</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>5 </th>\n",
        "      <td> 1</td>\n",
        "      <td> 1</td>\n",
        "      <td>  6</td>\n",
        "      <td> 507.5</td>\n",
        "      <td> 150000</td>\n",
        "      <td> 503.5</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>6 </th>\n",
        "      <td> 1</td>\n",
        "      <td> 1</td>\n",
        "      <td>  7</td>\n",
        "      <td> 507.0</td>\n",
        "      <td> 150000</td>\n",
        "      <td> 503.0</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>7 </th>\n",
        "      <td> 1</td>\n",
        "      <td> 2</td>\n",
        "      <td>  8</td>\n",
        "      <td> 506.5</td>\n",
        "      <td> 150000</td>\n",
        "      <td> 502.5</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>8 </th>\n",
        "      <td> 1</td>\n",
        "      <td> 3</td>\n",
        "      <td>  9</td>\n",
        "      <td> 506.0</td>\n",
        "      <td> 150000</td>\n",
        "      <td> 502.0</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>9 </th>\n",
        "      <td> 1</td>\n",
        "      <td> 3</td>\n",
        "      <td> 10</td>\n",
        "      <td> 505.5</td>\n",
        "      <td> 150000</td>\n",
        "      <td> 501.5</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>10</th>\n",
        "      <td> 1</td>\n",
        "      <td> 3</td>\n",
        "      <td> 11</td>\n",
        "      <td> 505.0</td>\n",
        "      <td> 150000</td>\n",
        "      <td> 501.0</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>11</th>\n",
        "      <td> 1</td>\n",
        "      <td> 3</td>\n",
        "      <td> 12</td>\n",
        "      <td> 504.5</td>\n",
        "      <td> 150000</td>\n",
        "      <td> 500.5</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>12</th>\n",
        "      <td> 1</td>\n",
        "      <td> 2</td>\n",
        "      <td> 13</td>\n",
        "      <td> 504.0</td>\n",
        "      <td> 150000</td>\n",
        "      <td> 500.0</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>13</th>\n",
        "      <td> 1</td>\n",
        "      <td> 2</td>\n",
        "      <td> 14</td>\n",
        "      <td> 503.5</td>\n",
        "      <td> 150000</td>\n",
        "      <td> 499.5</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>14</th>\n",
        "      <td> 1</td>\n",
        "      <td> 1</td>\n",
        "      <td> 15</td>\n",
        "      <td> 503.0</td>\n",
        "      <td> 150000</td>\n",
        "      <td> 499.0</td>\n",
        "    </tr>\n",
        "  </tbody>\n",
        "</table>\n",
        "</div>"
       ],
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 35,
       "text": [
        "    layer  row  column  stage   Rcond   rbot\n",
        "0       1    1       1  510.0  150000  506.0\n",
        "1       1    1       2  509.5  150000  505.5\n",
        "2       1    1       3  509.0  150000  505.0\n",
        "3       1    1       4  508.5  150000  504.5\n",
        "4       1    1       5  508.0  150000  504.0\n",
        "5       1    1       6  507.5  150000  503.5\n",
        "6       1    1       7  507.0  150000  503.0\n",
        "7       1    2       8  506.5  150000  502.5\n",
        "8       1    3       9  506.0  150000  502.0\n",
        "9       1    3      10  505.5  150000  501.5\n",
        "10      1    3      11  505.0  150000  501.0\n",
        "11      1    3      12  504.5  150000  500.5\n",
        "12      1    2      13  504.0  150000  500.0\n",
        "13      1    2      14  503.5  150000  499.5\n",
        "14      1    1      15  503.0  150000  499.0"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# update rCond values with single paramter value from top of script\n",
      "rivcells['Rcond'] = Rcond\n",
      "\n",
      "# make dataframe into list for flopy input\n",
      "rivdata = rivcells.values.tolist()\n",
      "\n",
      "# need to copy river cell info for each stress period\n",
      "rivdata = [rivdata for p in perlen]\n",
      "rivdata"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 36,
       "text": [
        "[[[1.0, 1.0, 1.0, 510.0, 150000.0, 506.0],\n",
        "  [1.0, 1.0, 2.0, 509.5, 150000.0, 505.5],\n",
        "  [1.0, 1.0, 3.0, 509.0, 150000.0, 505.0],\n",
        "  [1.0, 1.0, 4.0, 508.5, 150000.0, 504.5],\n",
        "  [1.0, 1.0, 5.0, 508.0, 150000.0, 504.0],\n",
        "  [1.0, 1.0, 6.0, 507.5, 150000.0, 503.5],\n",
        "  [1.0, 1.0, 7.0, 507.0, 150000.0, 503.0],\n",
        "  [1.0, 2.0, 8.0, 506.5, 150000.0, 502.5],\n",
        "  [1.0, 3.0, 9.0, 506.0, 150000.0, 502.0],\n",
        "  [1.0, 3.0, 10.0, 505.5, 150000.0, 501.5],\n",
        "  [1.0, 3.0, 11.0, 505.0, 150000.0, 501.0],\n",
        "  [1.0, 3.0, 12.0, 504.5, 150000.0, 500.5],\n",
        "  [1.0, 2.0, 13.0, 504.0, 150000.0, 500.0],\n",
        "  [1.0, 2.0, 14.0, 503.5, 150000.0, 499.5],\n",
        "  [1.0, 1.0, 15.0, 503.0, 150000.0, 499.0]],\n",
        " [[1.0, 1.0, 1.0, 510.0, 150000.0, 506.0],\n",
        "  [1.0, 1.0, 2.0, 509.5, 150000.0, 505.5],\n",
        "  [1.0, 1.0, 3.0, 509.0, 150000.0, 505.0],\n",
        "  [1.0, 1.0, 4.0, 508.5, 150000.0, 504.5],\n",
        "  [1.0, 1.0, 5.0, 508.0, 150000.0, 504.0],\n",
        "  [1.0, 1.0, 6.0, 507.5, 150000.0, 503.5],\n",
        "  [1.0, 1.0, 7.0, 507.0, 150000.0, 503.0],\n",
        "  [1.0, 2.0, 8.0, 506.5, 150000.0, 502.5],\n",
        "  [1.0, 3.0, 9.0, 506.0, 150000.0, 502.0],\n",
        "  [1.0, 3.0, 10.0, 505.5, 150000.0, 501.5],\n",
        "  [1.0, 3.0, 11.0, 505.0, 150000.0, 501.0],\n",
        "  [1.0, 3.0, 12.0, 504.5, 150000.0, 500.5],\n",
        "  [1.0, 2.0, 13.0, 504.0, 150000.0, 500.0],\n",
        "  [1.0, 2.0, 14.0, 503.5, 150000.0, 499.5],\n",
        "  [1.0, 1.0, 15.0, 503.0, 150000.0, 499.0]],\n",
        " [[1.0, 1.0, 1.0, 510.0, 150000.0, 506.0],\n",
        "  [1.0, 1.0, 2.0, 509.5, 150000.0, 505.5],\n",
        "  [1.0, 1.0, 3.0, 509.0, 150000.0, 505.0],\n",
        "  [1.0, 1.0, 4.0, 508.5, 150000.0, 504.5],\n",
        "  [1.0, 1.0, 5.0, 508.0, 150000.0, 504.0],\n",
        "  [1.0, 1.0, 6.0, 507.5, 150000.0, 503.5],\n",
        "  [1.0, 1.0, 7.0, 507.0, 150000.0, 503.0],\n",
        "  [1.0, 2.0, 8.0, 506.5, 150000.0, 502.5],\n",
        "  [1.0, 3.0, 9.0, 506.0, 150000.0, 502.0],\n",
        "  [1.0, 3.0, 10.0, 505.5, 150000.0, 501.5],\n",
        "  [1.0, 3.0, 11.0, 505.0, 150000.0, 501.0],\n",
        "  [1.0, 3.0, 12.0, 504.5, 150000.0, 500.5],\n",
        "  [1.0, 2.0, 13.0, 504.0, 150000.0, 500.0],\n",
        "  [1.0, 2.0, 14.0, 503.5, 150000.0, 499.5],\n",
        "  [1.0, 1.0, 15.0, 503.0, 150000.0, 499.0]]]"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# make the riv package object\n",
      "riv = flopy.modflow.mfriv.ModflowRiv(mf, irivcb=59, layer_row_column_data=rivdata, extension='riv', unitnumber=18, options=None, naux=0)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 37
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "####Make the leaking ditch:####"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# designate flux cells\n",
      "flux_cells = zip(np.ones(15, dtype=int) * 15, np.arange(1, 16))\n",
      "flux_cells\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 38,
       "text": [
        "[(15, 1),\n",
        " (15, 2),\n",
        " (15, 3),\n",
        " (15, 4),\n",
        " (15, 5),\n",
        " (15, 6),\n",
        " (15, 7),\n",
        " (15, 8),\n",
        " (15, 9),\n",
        " (15, 10),\n",
        " (15, 11),\n",
        " (15, 12),\n",
        " (15, 13),\n",
        " (15, 14),\n",
        " (15, 15)]"
       ]
      }
     ],
     "prompt_number": 38
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "q = Qleak / len(flux_cells) # flow rate in each constant flux cell"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 39
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# now make list of layer, row, column, q info for each pumping cell, for each stress period\n",
      "bflux = [[[1, c[0], c[1], q] for c in flux_cells] for p in perlen]\n",
      "\n",
      "# add pumping well to second (transient) stress period\n",
      "bflux[1].append(pumping_well_info2)\n",
      "\n",
      "# add second well at location M for prediction stress period\n",
      "bflux[2].append(pumping_well_info3)\n",
      "\n",
      "bflux"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 40,
       "text": [
        "[[[1, 15, 1, 3000],\n",
        "  [1, 15, 2, 3000],\n",
        "  [1, 15, 3, 3000],\n",
        "  [1, 15, 4, 3000],\n",
        "  [1, 15, 5, 3000],\n",
        "  [1, 15, 6, 3000],\n",
        "  [1, 15, 7, 3000],\n",
        "  [1, 15, 8, 3000],\n",
        "  [1, 15, 9, 3000],\n",
        "  [1, 15, 10, 3000],\n",
        "  [1, 15, 11, 3000],\n",
        "  [1, 15, 12, 3000],\n",
        "  [1, 15, 13, 3000],\n",
        "  [1, 15, 14, 3000],\n",
        "  [1, 15, 15, 3000]],\n",
        " [[1, 15, 1, 3000],\n",
        "  [1, 15, 2, 3000],\n",
        "  [1, 15, 3, 3000],\n",
        "  [1, 15, 4, 3000],\n",
        "  [1, 15, 5, 3000],\n",
        "  [1, 15, 6, 3000],\n",
        "  [1, 15, 7, 3000],\n",
        "  [1, 15, 8, 3000],\n",
        "  [1, 15, 9, 3000],\n",
        "  [1, 15, 10, 3000],\n",
        "  [1, 15, 11, 3000],\n",
        "  [1, 15, 12, 3000],\n",
        "  [1, 15, 13, 3000],\n",
        "  [1, 15, 14, 3000],\n",
        "  [1, 15, 15, 3000],\n",
        "  [1, 7, 11, -20000]],\n",
        " [[1, 15, 1, 3000],\n",
        "  [1, 15, 2, 3000],\n",
        "  [1, 15, 3, 3000],\n",
        "  [1, 15, 4, 3000],\n",
        "  [1, 15, 5, 3000],\n",
        "  [1, 15, 6, 3000],\n",
        "  [1, 15, 7, 3000],\n",
        "  [1, 15, 8, 3000],\n",
        "  [1, 15, 9, 3000],\n",
        "  [1, 15, 10, 3000],\n",
        "  [1, 15, 11, 3000],\n",
        "  [1, 15, 12, 3000],\n",
        "  [1, 15, 13, 3000],\n",
        "  [1, 15, 14, 3000],\n",
        "  [1, 15, 15, 3000],\n",
        "  [1, 9, 9, -30000]]]"
       ]
      }
     ],
     "prompt_number": 40
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# create the well package\n",
      "wel = flopy.modflow.ModflowWel(mf, layer_row_column_Q=bflux)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 41
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "####run the model####"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#write the model input files\n",
      "mf.write_input()\n",
      "\n",
      "\n",
      "# manually append info for writing out riv package results to nam file (couldn't figure out how to make flopy do this)\n",
      "nam = open('{}.nam'.format(modelname),'a')\n",
      "nam.write('DATA(BINARY)  59 {}.rivout REPLACE\\n'.format(modelname))\n",
      "nam.close()\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 42
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "####Show everything####"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# show the observation locations with the K zones, River cells, and pumping wells\n",
      "fig = plt.figure()\n",
      "ax = fig.add_subplot(111)\n",
      "extent = [0, 1500, 0, 1500]\n",
      "\n",
      "# add the river cells and wells to the Kzones array so we can verify where they are\n",
      "for i in range(len(rivcells)):\n",
      "    Kzones[rivcells.row[i] - 1, rivcells.column[i] - 1] = 0\n",
      "for w in bflux[1]:\n",
      "    r, c = w[1:3]\n",
      "    Kzones[r - 1, c - 1] = 3\n",
      "ax.imshow(Kzones, extent=extent, interpolation='None')\n",
      "\n",
      "# bring in observation info\n",
      "obs = pd.read_csv('../observations.csv')\n",
      "ax.scatter(obs.X, obs.Y, c='w')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 43,
       "text": [
        "<matplotlib.collections.PathCollection at 0x1101b9e10>"
       ]
      },
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAQkAAAD7CAYAAAB5RWHCAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHb5JREFUeJzt3XtYVPW6B/DvDBcBL2gqEAwmIncQBNG0i5qiZVqGpqkH\nvGQ3dzd3oe5ummfDDJmnNPM8z362aFvblud00d1W8pZuU0MUb4GJ2aCAwFGQ+22A3/mD3RipS1jM\nzJoZvp/n4XlizeV9IebrmjVr/V6VEEKAiOg21Eo3QETWjSFBRJIYEkQkiSFBRJIYEkQkiSFBRJIc\nlW7gt8aMGYODBw8q3QZRlzN69GgcOHDglrdZ1Z7EwYMHIYS449fy5cvbdT9TfLEWa3WFWlL/OFtV\nSBCR9WFIEJEkmwyJMWPGsBZrsZaFqIQQVnPthkqlghW1Q9RlSL32bHJPgogshyFBRJIYEkQkiSFB\nRJKs6ozL9lKpVijdgu1TqeQ97uxy0/bRFck5Nh+xosMPGTDAHZcuLZZRrC3uSRCRJIYEEUliSBCR\nJIYEEUliSBCRJIYEEUliSBCRJIYEEUmSDIkFCxbA09MTERERN922evVqqNVqlJWVGbdptVoEBAQg\nODgYu3fvNm4/ceIEIiIiEBAQgFdeecWE7RORuU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g1i8ODBYsCAAca/jxdeeMEktX5bz9nZ2fiz/Zafn58x\nJExRTy6elk1EkmzmmAQRKYMhQUSSGBJEJIkhQUSSGBJEJIkhQUSSGBJEJIkhQUSS/h9uzDAx5pUu\n1QAAAABJRU5ErkJggg==\n",
       "text": [
        "<matplotlib.figure.Figure at 0x10fe8b710>"
       ]
      }
     ],
     "prompt_number": 43
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "####Run the model####\n",
      "if using a PC, could just do this:"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "\n",
      "    #run the model\n",
      "    success, mfoutput = mf.run_model2(silent=True, pause=False)\n",
      "    if not success:\n",
      "        raise Exception('MODFLOW did not terminate normally.')\n"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "I couldn't get this to work on the mac, though, so I just ran from the terminal:  \n",
      "\n",
      "    $ wine mf2005.exe p9\n",
      "\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 43
    }
   ],
   "metadata": {}
  }
 ]
}